#include <cctype>
#include <iostream>
using namespace std;

bool is_str_wildcard(const char *pattern, const char *str)
{
    if(*pattern == '\0' && *str == '\0')
        return true;
    if(*pattern == '\0' || *str == '\0')
        return false;

    if(*pattern == '?' && (isdigit(*str) || isalpha(*str)))
        return is_str_wildcard(pattern + 1, str + 1);
    else if(*pattern == '*')
    {
        // 遇到连续多个*号，只有一个管作用(否则超时)
        while(*pattern=='*'){
            pattern++;
        }
        pattern--;
        return is_str_wildcard(pattern + 1, str + 1) || is_str_wildcard(pattern, str + 1) || is_str_wildcard(pattern + 1, str);

    }
    else if(toupper(*pattern) == toupper(*str))
        return is_str_wildcard(pattern + 1, str + 1);
    else
        return false;

}


int main() 
{
    string pattern, str;
    cin >> pattern >> str;
    bool ret = is_str_wildcard(pattern.c_str(), str.c_str());

    if(ret)
        cout << "true" << endl;
    else
        cout << "false" << endl;

    return 0;
}
